package com.dyzx.hbb.modules.sys.mapper;

import com.dyzx.hbb.modules.sys.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author Administrator
* @description 针对表【sys_user(用户表)】的数据库操作Mapper
* @createDate 2025-04-14 15:31:43
* @Entity com.dyzx.hbb.modules.sys.entity.SysUser
*/
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("""
    SELECT perms_key FROM sys_menu sm WHERE deleted = 0 AND sm.id IN ( SELECT srm.menu_id FROM sys_role_menu srm INNER JOIN sys_role_user sru ON sru.deleted = 0 AND    srm.deleted = 0 AND  srm.role_id = sru.role_id WHERE sru.user_id = #{userId})
""")
    List<String> getMenuPermissions(@Param("userId") Long userId);



    @Select("""
    SELECT perms_key
    FROM sys_menu sm  where  deleted=0
""")
    List<String> getMenuAdminPermissions();
}




